package com.microservices.yucloud.appweb.guard;

import com.microservices.yucloud.appweb.domain.Orders;
import com.microservices.yucloud.appweb.enums.BizOrderEventsEnum;
import com.microservices.yucloud.appweb.enums.BizOrderStatusEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.statemachine.StateContext;
import org.springframework.statemachine.guard.Guard;

/**
 * @author zy
 * @date 2019-08-30 15:59
 **/
@Slf4j
public class BizOrderReviewGuard implements Guard<BizOrderStatusEnum, BizOrderEventsEnum> {
    @Override
    public boolean evaluate(StateContext<BizOrderStatusEnum, BizOrderEventsEnum> stateContext) {
        Orders orders = stateContext.getMessage().getHeaders().get("orders", Orders.class);
        log.info("订单对象[{}]", orders);
        return false;
    }
}
